<html>
<body>
<style type="text/css">
            body {
                background: #FFFFFF url("images/bg.png") repeat;
                background-attachment:fixed;
            }
			.button 
			{
        background-color:beige;
        cursor:pointer; }
		
		.btn
		{
		

			background-color:#FFF5EE;
			cursor:pointer;
		}
			.btn1
		{
			border-radius: 5px;
			box-shadow: #EEE6E6 3px 3px 3px; 
			border: 1px solid #892525;
			background-color:#F8F1D4;
			cursor:pointer;
		}
    }
        </style>
<?php
$search = $_REQUEST['SearchBox'];
include 'conn.php';

$result = mysql_query("SELECT ar.NRIC, c.CustomerName, ar.SignInTimeStamp, ar.SignOutTimeStamp
FROM attendancerecord ar
LEFT JOIN Client c ON ar.NRIC = c.NRIC
WHERE DATE( ar.SignInTimeStamp ) = CURDATE( ) 
AND (ar.NRIC LIKE  '%$search%'
OR c.CustomerName LIKE  '%$search%'
OR ar.SignInTimeStamp LIKE  '%$search%'
OR ar.SignOutTimeStamp LIKE  '%$search%')
");

echo "<table class='tablereport' id='tblAttendance' border='0'  valign='top'><tr >
<td name='NRIC'>
<font face='Arial, Helvetica, sans-serif'>NRIC</font>
</td>
<td name='CustomerName'>
<font face='Arial, Helvetica, sans-serif'>Name</font>
</td>
<td name='Date'>
<font face='Arial, Helvetica, sans-serif'>Date</font>
</td>
<td name='TimeIn' >
<font face='Arial, Helvetica, sans-serif'>Time In</font>
</td>
<td name='TimeOut'>
<font face='Arial, Helvetica, sans-serif'>Time Out</font>
</td>
<td name='SignOut'>
<font face='Arial, Helvetica, sans-serif'>Sign Out </font><form method='POST'><input type='submit' button class='btn'name='signoutall'value='Sign Out All' size='10' maxlength='9'/></form>
</td>
</tr>";
$count=0;
while($row = mysql_fetch_array($result))
  {
  echo"<tr>
<td >
<font face='Arial, Helvetica, sans-serif'>".$row['NRIC']."</font>
</td >
<td >
<font face='Arial, Helvetica, sans-serif'>".$row['CustomerName']."</font>
</td >
<td >
<font face='Arial, Helvetica, sans-serif'>".$today = date('j F, Y')."</font>
</td>
";
 $signin = strtotime($row['SignInTimeStamp']);
$signintime = date('H:i:s', $signin);
echo"<td >
<font face='Arial, Helvetica, sans-serif'>".$signintime."</font>
</td>";
if($row['SignOutTimeStamp']=='0000-00-00 00:00:00'|| $row['SignOutTimeStamp']==NULL)
		{echo "
		<td >
		<font face='Arial, Helvetica, sans-serif'></font>
		</td>
		<td style='text-align:center;vertical-align:middle'>
<form method='POST' >
		<button type='submit' name='btnSO' value='{$row['NRIC']}'>
              Sign Out
            </button></form>
		</td>";
}
else{ 
$signout = strtotime($row['SignOutTimeStamp']);
$signouttime = date('H:i:s', $signout);
echo"
<td >
<font face='Arial, Helvetica, sans-serif'>".$signouttime."</font>
</td>
<td style='text-align:center;vertical-align:middle'>
</td>
";
}"

</tr>"
;$count++;
  }
echo "</table>";

			 ?>
			 </body>
			 </html>